$(document).ready(function(){
	(function(d, s, id) {
		  var js, fjs = d.getElementsByTagName(s)[0];
		  if (d.getElementById(id)) {return;}
		  js = d.createElement(s); js.id = id;
		  js.src = "//connect.facebook.net/fr_FR/all.js#xfbml=1";
		  fjs.parentNode.insertBefore(js, fjs);
	}(document, 'script', 'facebook-jssdk'));
	
	// Init FB api
	window.fbAsyncInit = function()
	{
	    FB.init({
	      appId      : '111934045501569', // App ID
	      //status     : true, // check login status
	      cookie     : true, // enable cookies to allow the server to access the session
	      //oauth      : true, // enable OAuth 2.0
	      xfbml      : true  // parse XFBML
	});
	    
	// Get user
	FB.api('/me', function(response) {
		$('.user-pic').html('<img src="https://graph.facebook.com/' + response.id + '/picture" alt="' + response.name + '" />');
		$('.user-name').html('<span>' + response.first_name + '</span>');
		
		//$('.classification-wrapper li span').html('<img src="https://graph.facebook.com/' + response.id + '/picture" alt="' + response.name + '" />');
		//$('.classification-wrapper li h2').html('<h2>' + response.first_name + '</h2>');
		//alert('<img src="https://graph.facebook.com/' + response.id + '/picture" alt="' + response.name + '" />' + response.name);
	});
	
	// Share résult on facebook
	$('.q-share-btn').click(function(){
		FB.ui(
		{
			method: 'feed',
			name: 'HitQuizz',
		    link: 'http://localhost/hitquizz-html/images/logo.png',
		    picture: 'http://fbrell.com/f8.jpg',
		    caption: 'J\'ai gagné à HitQuizz avec un score de 100%',
		    description: 'Hitquizz le quiz sur le cinéma, la nouvelle application facebook incontournable !'
		  }
		);
	});
	
	$('.q-reviewBar-btns').bind({
		  click: function() {
			  $('.time').css('visibility', 'hidden');
		  }
	});
	
	};
});